package com.example.javastream.demo;

import java.util.stream.Stream;

public class SortOps {
    public static void main(String[] args) {
        Stream<Integer> integerStream = Stream.of(1, 3, 2, 4, 5);
        // 排序
        integerStream.sorted().forEach(System.out::println);

        System.out.println("1==========================");
        // 也可传入参数Comparator指定排序方式
        integerStream = Stream.of(1, 3, 2, 4, 5);
        integerStream.sorted((e1, e2) -> e1 - e2).forEach(System.out::println);
    }
}
